package Models;

// <editor-fold defaultstate="collapsed" desc=" UML Marker "> 

import DB.DBCustomer;
import DB.RowAbstract;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;

// #[regen=yes,id=DCE.06182DA2-2079-E0FE-3B91-5D7A8B8C152B]
// </editor-fold>
public class Invoice extends RowAbstract
{
	// <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
	// #[regen=yes,id=DCE.D1EFB686-5F80-9F5A-DEA2-09DECC005596]
	// </editor-fold> 
	private Secretary secretary;

	// <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
	// #[regen=yes,id=DCE.8F71464B-1406-B4A6-D8A2-8956E29C5A2D]
	// </editor-fold> 
	private ServiceType serviceType;

	// <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
	// #[regen=yes,id=DCE.48847B33-6C16-5BE4-B64A-AECE4F3B0A19]
	// </editor-fold> 
	private int invoiceNo;

	// <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
	// #[regen=yes,id=DCE.1F86DBCD-6FFC-409A-D1DC-5C29E9EE40FB]
	// </editor-fold> 
	private Customer customer;

	// <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
	// #[regen=yes,id=DCE.E6E9FAE4-3125-CFDD-C4CD-83C3D82F5BAF]
	// </editor-fold> 
	private double price;

	// <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
	// #[regen=yes,id=DCE.E892B333-3FF8-671E-1C61-448725FB638F]
	// </editor-fold>
	public Invoice ()
	{}

	public void importData(ResultSet data) throws SQLException
	{
		int secretaryNo = data.getInt("secretary");
		int serviceTypeNo = data.getInt("serviceType");
		this.setInvoiceNo(data.getInt("invoiceNo"));
		int customerNo = data.getInt("customerNo");
		this.setPrice(data.getDouble("price"));
		this.fetchDependentData(secretaryNo, serviceTypeNo, customerNo);
	}
	
	public void fetchDependentData(int secretaryNo, int serviceTypeNo, int customerNo)
	{
		//Secretary DB...
		//ServiceType DB...
		DBCustomer dbc = new DBCustomer();
		this.setCustomer(dbc.fetchRow("customerNo = "+customerNo, null));
	}

	// <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
	// #[regen=yes,regenBody=yes,id=DCE.0ED973B4-42B8-DF77-E02C-EDA5EBCC86BB]
	// </editor-fold> 
	public Customer getCustomer () {
		return customer;
	}

	// <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
	// #[regen=yes,regenBody=yes,id=DCE.82E2B133-D8D7-1BDB-6376-8BC527F6C9D5]
	// </editor-fold> 
	public void setCustomer (Customer val) {
		customer = val;
	}

	// <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
	// #[regen=yes,regenBody=yes,id=DCE.EBB36355-875C-442F-9455-0BD3B5A66619]
	// </editor-fold> 
	public int getInvoiceNo () {
		return invoiceNo;
	}

	// <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
	// #[regen=yes,regenBody=yes,id=DCE.A3ED5D9E-8C35-F458-DAC9-5FE6A0F0732E]
	// </editor-fold> 
	public void setInvoiceNo (int val) {
		invoiceNo = val;
	}

	// <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
	// #[regen=yes,regenBody=yes,id=DCE.D5BDB438-FCD9-7B43-2E36-3BAB4C4564E0]
	// </editor-fold> 
	public double getPrice () {
		return price;
	}

	// <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
	// #[regen=yes,regenBody=yes,id=DCE.ED558D49-F897-4D3D-F852-90ED0F74BC2B]
	// </editor-fold> 
	public void setPrice (double val) {
		price = val;
	}

	// <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
	// #[regen=yes,regenBody=yes,id=DCE.B40E7DFD-1E7E-3622-30D1-AEDBC5EB9AA8]
	// </editor-fold> 
	public Secretary getSecretary () {
		return secretary;
	}

	// <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
	// #[regen=yes,regenBody=yes,id=DCE.4801045E-787E-C199-0A38-DE44CA341239]
	// </editor-fold> 
	public void setSecretary (Secretary val) {
		secretary = val;
	}

	// <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
	// #[regen=yes,regenBody=yes,id=DCE.080E9677-7C49-BA32-F7C7-8637D6BE7337]
	// </editor-fold> 
	public ServiceType getServiceType () {
		return serviceType;
	}

	// <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
	// #[regen=yes,regenBody=yes,id=DCE.A0945BF0-F15E-60E5-25FE-4F379DABCDD3]
	// </editor-fold> 
	public void setServiceType (ServiceType val) {
		serviceType = val;
	}
}